package com.atguigu.day211105.work;

public class BankCard {
    private int id;
    private double balance;

    public BankCard() {
    }

    public BankCard(int id, double balance) {
        this.id = id;
        this.balance = balance;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public void withdraw(double money) {
        if (money < 0) {
            System.out.println("输入错误");
        } else if (money > balance) {
            System.out.println("余额不足");
        }
        balance -= money;
    }

    public void save(double money) {
        if (money < 0) {
            System.out.println("输入错误");
        }
        balance += money;
    }
    public String getInfo(){
        return "账户:"+id+",余额:"+balance;
    }
}
